//
//  ChangeAlbumTableViewCell.m
//  HimalayaMusic
//
//  Created by dllo on 16/1/14.
//  Copyright © 2016年 WXCLegendary. All rights reserved.
//

#import "ChangeAlbumTableViewCell.h"

@implementation ChangeAlbumTableViewCell
-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.imageViews = [[UIImageView alloc] init];
        self.userImage = [[UIImageView alloc] init];
        self.dramaImage = [[UIImageView alloc] init];
        self.introLabel = [[UILabel alloc] init];
        self.titleLabel = [[UILabel alloc] init];
        self.userLabel = [[UILabel alloc] init];
        self.dramaLabel = [[UILabel alloc] init];
        self.collectButton = [UIButton buttonWithType:UIButtonTypeSystem];
        [self.collectButton addTarget:self action:@selector(collectButton:) forControlEvents:UIControlEventTouchUpInside];
        self.titleLabel.font = [UIFont systemFontOfSize:15 weight:0.5];
        self.introLabel.textColor = [UIColor colorWithRed:0.53 green:0.54 blue:0.55 alpha:1];
        self.introLabel.font = [UIFont  systemFontOfSize:13];
        
        
        [self addSubview:self.imageViews];
        [self addSubview:self.userLabel];
        [self addSubview:self.userImage];
        [self addSubview:self.dramaLabel];
        [self addSubview:self.dramaImage];
        [self addSubview:self.titleLabel];
        [self addSubview:self.introLabel];
        
    }
    return self;
}

-(void)collectButton:(UIButton *)button {
    
    
    
}

-(void)layoutSubviews {
    [super layoutSubviews];
    
    self.imageViews.frame = CGRectMake(10, 10, self.height - 20, self.height - 20);
    self.titleLabel.frame = CGRectMake(self.imageViews.origin.x + self.imageViews.width + 10, self.imageViews.origin.y + 15, self.imageViews.width, 20);
    
    self.introLabel.frame = CGRectMake(self.titleLabel.origin.x, self.titleLabel.origin.y + self.titleLabel.height + 5, self.titleLabel.width, 50);
    
    self.userImage.frame = CGRectMake(self.introLabel.origin.x, self.introLabel.origin.y + self.introLabel.height + 10, 15, 15);
    
    self.userLabel.frame = CGRectMake(self.userImage.origin.x + self.userImage.width + 5, self.userImage.origin.y, 50, 15);
    self.dramaImage.frame = CGRectMake(self.userLabel.origin.x + 40 + 20, self.userLabel.origin.y, 15, 15);
    
    self.dramaLabel.frame = CGRectMake(self.dramaImage.origin.x + self.dramaImage.width + 5 , self.dramaImage.origin.y, 50, 15);
    
    
}

-(void)setModel:(AnchorModel *)model {
    if (_model != model) {
        _model = model;
    }
    [self.imageViews sd_setImageWithURL:[NSURL URLWithString:model.middleLogo]];
    self.titleLabel.text = model.nickname;
    self.introLabel.text = model.personDescribe;
    self.userLabel.text = [HeperTools SharePlayCount:model.followersCounts.intValue];;
    self.dramaLabel.text = model.tracksCounts.stringValue;
    self.userImage.image = [UIImage imageNamed:@"user_fans@2x"];
    self.dramaImage.image = [UIImage imageNamed:@"album_tracks@2x"];
    self.userLabel.font = [UIFont systemFontOfSize:12];
    self.dramaLabel.font = [UIFont systemFontOfSize:12];
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
